package com.bhs.sansonglogistics.dialog;

import android.content.Context;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.bhs.sansonglogistics.R;
import com.bhs.sansonglogistics.utils.MyUtils;
import com.lxj.xpopup.core.CenterPopupView;

/**
 * 报价接单成功弹窗
 */
public class QuotationReceivedSuccessfullyDialog extends CenterPopupView implements View.OnClickListener {

    private TextView mTvHint;
    private Button mBtnCheckOrder;
    private Button mBtnConfirm;
    private MyClickListener listener;
    private int type;
    public QuotationReceivedSuccessfullyDialog(@NonNull Context context,int type) {
        super(context);
        this.type=type;
    }

    @Override
    protected int getImplLayoutId() {
        return R.layout.dialog_quotation_received_successfully;
    }

    @Override
    protected void onCreate() {
        super.onCreate();
        initView();
        if(type==1){
            mTvHint.setText("接单成功");
        }else {
            mTvHint.setText("报价接单成功");
        }
    }

    // 设置最大宽度，看需要而定，
    @Override
    protected int getMaxWidth() {
        return MyUtils.getScreenWidth(getContext()) * 9 / 10;
    }

    private void initView() {
        mTvHint = findViewById(R.id.tv_hint);
        mBtnCheckOrder = findViewById(R.id.btn_check_order);
        mBtnConfirm = findViewById(R.id.btn_confirm);
        mBtnCheckOrder.setOnClickListener(this);
        mBtnConfirm.setOnClickListener(this);
    }

    public void setMyClickListener(@Nullable MyClickListener l) {
        this.listener = l;
    }

    @Override
    public void onClick(View view) {
        listener.onClick(view);
    }
}
